<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>订单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
			$("#searchForm1").validate({
				submitHandler: function(form){
					if($("#orderType").val()=="0"){
						alertx("请选择产品类型");
					}else{
						form.submit();
					}
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/mid/torderRquest/">订单列表</a></li>
		<!--<shiro:hasPermission name="mid:torderRquest:edit"><li><a href="${ctx}/mid/torderRquest/form">订单添加</a></li></shiro:hasPermission>-->
	</ul>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/mid/torderRquest/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="">下载模板</a>
		</form>
	</div>
	<form:form id="searchForm" modelAttribute="torderRquest" action="${ctx}/mid/torderRquest/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	
	<form:form id="searchForm1" name='searchForm1' modelAttribute="torderRquest" action="${ctx}/mid/torderRquest/exportExcel" method="post" class="breadcrumb form-search">
		<ul class="ul-form">
			<li><label>产品类型：</label>
			<form:select path="orderType"
				class="input-medium ">
				<form:option value="0" label="请选择" />
				<form:options items="${fns:getDictList('product_type')}"
					itemLabel="label" itemValue="value" htmlEscape="false" /></form:select>
			</li>
			<li class="btns">
			<input id="btnImport" class="btn btn-primary" type="submit" value="导出"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>平台订单号</th>
				<th>订单号</th>
				<th>收货人姓名</th>
				<th>身份证</th>
				<th>电话</th>
				<th>收货地址</th>
				<th>金额</th>
				<th>创建时间</th>
				<th>运单号</th>
				<shiro:hasPermission name="mid:torderRquest:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="torderRquest">
			<tr>
				<td>
					${torderRquest.tId}
				</td>
				<td>
					${torderRquest.tOrderNo}
				</td>
				<td>
					${torderRquest.tClentName}
				</td>
				<td>
					${torderRquest.tClentId}
				</td>
				<td>
					${torderRquest.tPhoneNo}
				</td>
				<td>
					${torderRquest.tAddressProvince}${torderRquest.tAddressCity}${torderRquest.tAddressArea}${torderRquest.tAddressDetail}
				</td>
				<td>
					${torderRquest.nTotalPrice}
				</td>
				<td>
					<fmt:formatDate value="${torderRquest.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${torderRquest.waybillNo}
				</td>
				<shiro:hasPermission name="mid:torderRquest:edit"><td>
					<a href="">添加运单号</a>
    				<a href="${ctx}/mid/torderRquest/form?id=${torderRquest.id}">修改</a>
    				<a href="${ctx}/mid/torderRquest/formDetail?id=${torderRquest.id}">查看明细</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>